package com.hanggold.springboot.listener;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class MyListener  implements ApplicationListener<MyApplicationEvent> {


    @Value("${JAVA_HOME}")
    private String name;


    @Override
    public void onApplicationEvent(MyApplicationEvent event) {

        System.out.println("事件监听: " + event.getSource() + " ,name: " + name);
    }



}
